#ifndef QP_QEP_HPP
#define QP_QEP_HPP

#include "QEvt.hpp"
#include "QHsm.hpp"

#define QP_VERSION 0x4504U
#define QP_VERSION_STR "4.5.04"

//! Perform downcast of an event onto a subclass of QEvt @p class_
/// @description
/// This macro encapsulates the downcast of QEvt pointers, which violates
/// MISRA-C 2004 rule 11.4(advisory). This macro helps to localize this
/// deviation.
///
#define Q_EVT_CAST(class_) (std::dynamic_pointer_cast<const class_>(e))

//! Perform cast from unsigned integer @p uint_ to pointer of type @p type_.
/// @description
/// This macro encapsulates the cast to (type_ *), which QP ports or
/// application might use to access embedded hardware registers.
/// Such uses can trigger PC-Lint "Note 923: cast from int to pointer"
/// and this macro helps to encapsulate this deviation.
///
#define Q_UINT2PTR_CAST(type_, uint_) (reinterpret_cast<type_ *>(uint_))

#define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0]))

namespace QP {
//! the current QP version number string based on QP_VERSION_STR
const char versionStr[]{QP_VERSION_STR};

class QEP {
 public:
  //! get the current QEP version number string of the form "X.Y.Z"
  static char const *getVersion(void) { return versionStr; }
};
}

#endif  // QP_QEP_HPP
